home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / createOutlinerPanelMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.9 KB  |  194 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:     9 June 1997
  22. //  Author:         jvs
  23. //
  24. //
  25. // Create an outliner panel's menu bar
  26. //
  27.  
  28. global proc buildOutlinerContextHelpItems(string $nameRoot, string $menuParent)
  29. //
  30. //  Description:
  31. //        Build context sensitive menu items
  32. //        
  33. //  Input Arguments:
  34. //        $nameRoot - name to use as the root of all item names
  35. //        $menuParent - the name of the parent of this menu
  36. //
  37. //  Return Value:
  38. //      None
  39. //
  40. {
  41.     menuItem -label "Help on Outliner..."
  42.         -enableCommandRepeat false
  43.         -command "showHelp Outliner";
  44. }
  45.  
  46. global proc createOutlinerPanelMenu( string $panel )
  47. {
  48.     // if this menu has already been built, return
  49.     //
  50.     string $panelControl = `panel -q -control $panel`;
  51.     if ( `menuBarLayout -exists $panelControl` ){
  52.         setParent $panelControl;
  53.         string $ma[] = `menuBarLayout -q -menuArray $panelControl`;
  54.         for ( $name in $ma ){
  55.             if ( $name == "Show" ){
  56.                 return;
  57.             }
  58.         }
  59.     }
  60.  
  61.     source "OutlinerEdMenu.mel" ;
  62.     // By the time we get here, we know the menu bar
  63.     // of the outlinerPanel is the current menu bar
  64.     //
  65.     // Get the name of the outliner editor in this panel
  66.     //
  67.     string $ed = `outlinerPanel -q -outlinerEditor $panel`;
  68.  
  69.     // Show Menu
  70.     //
  71.     string $showMenuName = `menu -tearOff true 
  72.             -label "Display" 
  73.             -familyImage "menuIconShow.xpm"
  74.             Show`;
  75.     menu -e
  76.         -pmc ("updateOutlinerPanelMenu "+$showMenuName+" "+$ed)
  77.         $showMenuName;
  78.  
  79.     menuItem -cb false -l "DAG Objects Only"
  80.         -c ("outlinerEditor -e -dag #1 "+$ed)
  81.         dagOnlyItem;
  82.     menuItem -cb false -l "Shapes"
  83.         -c ("outlinerEditor -e -shp #1 "+$ed)
  84.         shapesItem;
  85.     menuItem -cb false -l "Attributes (Channels)"
  86.         -c ("outlinerEditor -e -atr #1 "+$ed)
  87.         attributesItem;
  88.     menuItem -label "Set Members"
  89.         -checkBox false
  90.         -command ("outlinerEditor -edit -showSetMembers #1 " + $ed)
  91.         setMembersItem;
  92.     menuItem -cb false -l "Connected"
  93.         -c ("outlinerEditor -e -con #1 "+$ed)
  94.         connectionsItem;
  95.  
  96.     menuItem -divider true;
  97.     
  98.     menuItem  -l "Reveal Selected"
  99.         -c ("outlinerEditor -e -sc 1  "+$ed)
  100.         showSelectedItem;
  101.     int $outlinerLongName = 1;
  102.     if (!`outlinerEditor -query -niceNames $ed`) {
  103.         $outlinerLongName = (`outlinerEditor -query -longNames $ed` ? 2 : 0);
  104.     }
  105.     menuItem -l "Channel Names" -subMenu true;
  106.         radioMenuItemCollection;
  107.         menuItem -l "Nice"
  108.             -radioButton ( 1 == $outlinerLongName )
  109.             -command ("setOutlinerLongName 1 " + $ed)
  110.             niceNameItem;
  111.         menuItem -l "Long"
  112.             -radioButton ( 2 == $outlinerLongName )
  113.             -command ("setOutlinerLongName 2 " + $ed)
  114.             longNameItem;
  115.         menuItem -l "Short"
  116.             -radioButton ( 0 == $outlinerLongName )
  117.             -command ("setOutlinerLongName 0 " + $ed)
  118.             shortNameItem;
  119.         setParent -m ..;
  120.     string $sortOrder = `outlinerEditor -query -sortOrder $ed`;
  121.     menuItem -l "Sort Order" -subMenu true;
  122.         radioMenuItemCollection;
  123.         menuItem -l "Scene Hierarchy"
  124.             -radioButton ($sortOrder == "none")
  125.             -command ("outlinerEditor -edit -sortOrder none " + $ed)
  126.             noneSortOrderItem;
  127.         menuItem -l "Alphabetical Within Type"
  128.             -radioButton ($sortOrder == "dagName")
  129.             -command ("outlinerEditor -edit -sortOrder dagName " + $ed)
  130.             dagNameSortOrderItem;
  131.         setParent -m ..;
  132.  
  133.     menuItem -divider true;
  134.     menuItem -l "Select Set Members"
  135.         -command ("selectAllSetMembers " + $ed)
  136.         selectAllSetMembersItem;
  137.  
  138.     //    Create the filter UI menu.
  139.     //
  140.     filterUICreateMenu($ed, `setParent -query`);
  141.  
  142.     //    Add support for the Context Sensitive Help Menu.
  143.     //
  144.     addContextHelpProc $panel "buildOutlinerContextHelpItems";
  145.  
  146.     buildPanelPopupMenu( $panel );
  147. }
  148.  
  149. global proc updateOutlinerPanelMenu( string $menu, string $ed )
  150. //
  151. // Update the menu before it is posted.
  152. //
  153. {
  154.     setParent -m $menu;
  155.  
  156.     string $currentMenu = `setParent -q -m`;
  157.     string $dagOnlyItem = $currentMenu+"|dagOnlyItem";
  158.     string $shapesItem = $currentMenu+"|shapesItem";
  159.     string $attributesItem = $currentMenu+"|attributesItem";
  160.     string $connectionsItem = $currentMenu+"|connectionsItem";
  161.     string $setMembersItem = $currentMenu + "|setMembersItem";
  162.  
  163.     if ( `outlinerEditor -exists $ed` ){
  164.         menuItem -e -cb `outlinerEditor -q -dag $ed` $dagOnlyItem;
  165.         menuItem -e -cb `outlinerEditor -q -shp $ed` $shapesItem;
  166.         menuItem -e -cb `outlinerEditor -q -atr $ed` $attributesItem;
  167.         menuItem -e -cb `outlinerEditor -q -con $ed` $connectionsItem;
  168.         menuItem -edit
  169.             -checkBox `outlinerEditor -query -showSetMembers $ed`
  170.             $setMembersItem;
  171.         int $outlinerLongName = 1;
  172.         if (!`outlinerEditor -query -niceNames $ed`) {
  173.             $outlinerLongName = (`outlinerEditor -query -longNames $ed` ? 2 : 0);
  174.         }
  175.             menuItem -edit
  176.                 -radioButton ( 1 == $outlinerLongName )
  177.                 niceNameItem;
  178.             menuItem -edit
  179.                 -radioButton ( 2 == $outlinerLongName )
  180.                 longNameItem;
  181.             menuItem -edit
  182.                 -radioButton ( 0 == $outlinerLongName )
  183.                 shortNameItem;
  184.  
  185.         string $sortOrder = `outlinerEditor -query -sortOrder $ed`;
  186.             menuItem -edit
  187.                 -radioButton ($sortOrder == "none")
  188.                 noneSortOrderItem;
  189.             menuItem -edit
  190.                 -radioButton ($sortOrder == "dagName")
  191.                 dagNameSortOrderItem;
  192.     }
  193. }
  194.